Skip to content

auth: add DATABRICKS_DISCOVERY_HOST env var to override login.databricks.com#5283

Merged
simonfaltum merged 2 commits into
mainfrom
simonfaltum/discovery-host-env
May 20, 2026
Merged

auth: add DATABRICKS_DISCOVERY_HOST env var to override login.databricks.com#5283
simonfaltum merged 2 commits into
mainfrom
simonfaltum/discovery-host-env

Conversation

@simonfaltum
Copy link
Copy Markdown
Member

Why

The discovery login flow (databricks auth login without --host) opens https://login.databricks.com. That host is hardcoded in the CLI, so there is no way to point the flow at a non-production login instance during testing or development.

The SDK already exposes u2m.WithDiscoveryHost (added in databricks-sdk-go #1640, on the CLI's pinned v0.132.0). This PR wires it up.

Changes

Before: No way to override the discovery host. databricks auth login always opens https://login.databricks.com.

Now: If DATABRICKS_DISCOVERY_HOST is set, the CLI passes it through to u2m.WithDiscoveryHost(...). When unset, behavior is identical to before. The "Opening ... in your browser..." log line reflects the override host so it's clear which host is being opened.

Intended for testing and development against non-production login instances; unset for normal use.

Test plan

  • New unit test TestDiscoveryLogin_OverridesHostFromEnv confirms the env var is read and the log message reflects the override host
  • go test ./cmd/auth/... passes
  • ./task checks passes
  • ./task lint-q passes

…cks.com

The discovery login flow (databricks auth login without --host) opens
https://login.databricks.com. The SDK already supports overriding that
host via u2m.WithDiscoveryHost; this wires the option to a new
DATABRICKS_DISCOVERY_HOST environment variable so developers can point
the flow at a non-production login instance for testing.

The browser-open log line also reflects the override host so the user
can tell which host is being opened.
@simonfaltum simonfaltum merged commit 7fccd48 into main May 20, 2026
24 of 25 checks passed
@simonfaltum simonfaltum deleted the simonfaltum/discovery-host-env branch May 20, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants